package com.system.service.impl;

import java.util.List;

import com.base.service.impl.ServiceImpl;
import com.system.pojo.Noticeboard;
import com.system.service.INoticeboardService;

public class NoticeboardServiceImpl<T extends Noticeboard> extends
		ServiceImpl<T> implements INoticeboardService<T> {

	@Override
	public boolean create(T noticeboard) {
		if (noticeboard.getId()!=null) {
		List<T> list = this.getDao().createQuery(
					"select * from Noticeboard as n where n.id ="
							+ noticeboard.getId()).list();
		
		    list.get(0).setContent(noticeboard.getContent());
			this.getDao().save(list.get(0));
			return false;
		} else {
			this.getDao().create(noticeboard);
			return true;
		}
	}

}
